<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>GitHub Issue 1364</title>
    <link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
    <link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
    <script src="../../../dist/jsoneditor.js"></script>
  </head>
  <body>
    <div class="container">
      <a href="https://github.com/json-editor/json-editor/issues/1158">GitHub Issue 1364</a>
      <label for="value">Value</label>
      <textarea class="form-control" id="value" rows="6" style="font-size: 12px; font-family: monospace;"></textarea>
      <div id='editor_holder'></div>
    </div>

    <script>
      var defaultSchema = {
        "type": "object",
        "properties": {
          "engine": {
            "type": "string",
            "enum": ["none", "test1"]
          },
          "child1": {
            "type": "object",
            "properties": {
              "L2Name": {
                "type": "string",
                "options": {
                  "dependencies": {
                    "root.engine": "test1"
                  }
                }
              }
            }
          },
          "L1Name": {
            "type": "string",
            "options": {
              "dependencies": {
                "root.engine": "test1"
              }
            }
          }
        }
      }

      var value = document.querySelector('#value')
      var editor = new JSONEditor(document.getElementById('editor_holder'),{
        iconlib: 'fontawesome5',
        object_layout: 'normal',
        schema: defaultSchema,
        show_errors: 'always',
        theme: 'bootstrap4'
      });

      editor.on('change', function () {
        value.value = JSON.stringify(editor.getValue())
      })
    </script>
  </body>
</html>
